package com.macro.mall.portal.repository;

import com.macro.mall.portal.domain.MemberBrandAttention;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.mongodb.repository.MongoRepository;

/**
 * @author wangwang
 * @version 1.0
 * @description 会员品牌关注Reporsitory
 * @date 2025/7/29 20:58
 */
public interface MemberBrandAttentionRepository extends MongoRepository<MemberBrandAttention,String> {
    /**
     * 根据会员ID和品牌ID查找记录
     * @param memberId
     * @param brandId
     * @return
     */
    MemberBrandAttention findByMemberIdAndBrandId(Long memberId,Long brandId);

    /**
     * 根据会员ID和品牌ID删除记录
     * @param id
     * @param brandId
     * @return
     */
    int deleteByMemberIdAndBrandId(Long id, Long brandId);

    /**
     * 分页查询当前用户品牌关注列表
     * @param id
     * @param pageRequest
     * @return
     */
    Page<MemberBrandAttention> findByMemberId(Long id, PageRequest pageRequest);

    /**
     * 清空当前用户品牌关注列表
     * @param id
     */
    void deleteAllByMemberId(Long id);
}
